package com.shengzai.mapreduce.filterscore;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class MapFilterScore extends Mapper<LongWritable, Text,Text, IntWritable> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, IntWritable>.Context context) throws IOException, InterruptedException {
        String lines = value.toString();
        String[] split = lines.split(",");
        String values = split[0] + "," + split[1] + "," + split[2] + "," + split[3];
        int score = Integer.parseInt(split[4]);
        if (score>450){
            context.write(new Text(values),new IntWritable(score));
        }
    }
}
